package com.zztl.infiniteBand.presenter

import android.content.Context
import com.zztl.infiniteBand.base.BasePresenter
import com.zztl.infiniteBand.model.NoDataResponseBean
import com.zztl.infiniteBand.net.FilterSubscriber2
import com.zztl.infiniteBand.net.RetorfitServiceManger
import com.zztl.infiniteBand.net.converter.DataConverter
import com.zztl.infiniteBand.net.requestBean.UploadBloodpressureRequest
import com.zztl.infiniteBand.ui.view.mvpview.BloodpressureView

/**
 *  @desc
 *  @auth ${user}
 *  @time 2018/11/6  15:36
 */
class BloodpressurePresenter: BasePresenter<BloodpressureView>() {
    fun uploadData(request:UploadBloodpressureRequest,context: Context){
        addSubscribe(RetorfitServiceManger.observe(RetorfitServiceManger.instance!!.apiService.uploadBloodPressure(DataConverter.instance.toJson(request)))
                .subscribe(object : FilterSubscriber2<NoDataResponseBean>(context) {
                    override fun success(bean: NoDataResponseBean) {
                            view!!.success()
                    }

                    override fun fail(msg: String?) {
                    }
                }))
    }
}